﻿function Get-TSMProcess {    
    <#
        .SYNOPSIS
            Get TSM processes
                    
        .DESCRIPTION
            The Get-TSMProcess returns processes running on the TSM server

        .PARAMETER ProcessNumber
            The process number to search

        .EXAMPLE
            Get-TSMProcess

        .NOTES
            Contributors:  David Seibel
            Last Revision Date: 06/04/2015

    #>
    [CmdletBinding()]
    Param(
        [Parameter(Position = 0)]
        [string]$ProcessNumber
    )

    $whereProps = @()
    $whereProps += [PSCustomObject]@{ "Column" = "PROCESS_NUM";   "Operator" = "LIKE"; "Value" = $ProcessNumber }

    $query = Format-TSMQuery -Table "Processes" -Where $whereProps -OrderBy "PROCESS_NUM"
    $result = Invoke-TSMCommand -Command $query

    $defaultDisplaySet = 'PROCESS_NUM','PROCESS','STATUS'

    return Format-TSMData -Data $result -DefaultDisplaySet $defaultDisplaySet
}